package com.vench.teddy.common;

import lombok.Data;

/**
 * Author:liwc@tongtech.com
 * Created:2024/6/27
 */
@Data
public class Result<T> {

    private int code;

    private String msg;

    private T data;

    public static Result success(){
        Result result = new Result();
        result.setCode(ResultCode.RC200.getCode());
        return result;
    }

    public static <T> Result<T> success(String msg){
        Result result = new Result();
        result.setCode(ResultCode.RC200.getCode());
        result.setMsg(msg);
        return result;
    }

    public static <T> Result<T> success(T data){
        Result result = new Result();
        result.setCode(ResultCode.RC200.getCode());
        result.setData(data);
        return result;
    }

    public static <T> Result<T> success(String msg,T data){
        Result result = new Result();
        result.setCode(ResultCode.RC200.getCode());
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

}
